var map = new BMap.Map("map");  //{enableMapClick:false}
map.centerAndZoom(new BMap.Point(112.889757,28.224359),16);
map.setCurrentCity("长沙");

map.enableKeyboard();    //键盘方向移动
map.enableDragging();   // 鼠标拖动地图
map.enableDoubleClickZoom();   //双击放大地图

//向地图添加控件
    var scaleControl = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
    scaleControl.setUnit(BMAP_UNIT_IMPERIAL);
    map.addControl(scaleControl);
    var navControl = new BMap.NavigationControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,type:1});
    map.addControl(navControl);
    var overviewControl = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:false});
    map.addControl(overviewControl);
    map.addControl(new BMap.MapTypeControl({
        mapTypes:[
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
            //  BMAP_PERSPECTIVE_MAP
        ]}));




var mapPoints01 = [
    {x:112.900883,y:28.219443,name:"标志·麓谷坐标"},
    {x:112.898164,y:28.220081,name:"麓谷信息港"},
    {x:112.892338,y:28.214152,name:"麓谷企业广场"},
    {x:112.882127,y:28.235054,name:"芯城科技园"},
    {x:112.888834,y:28.236538,name:"中电软件园"},
    {x:112.88683,y:28.216767,name:"兴工国际工业园"}
];
var myIconMonitor = new BMap.Icon("images/house.png", new BMap.Size(30,30));
    for (let i=0;i<mapPoints01.length;i++) {
        var points = new BMap.Point(mapPoints01[i].x,mapPoints01[i].y);      //创建坐标点
        var markers = new BMap.Marker(points,{icon:myIconMonitor});
        var label = new BMap.Label(mapPoints01[i].name,{offset:new BMap.Size(-10,30)});
        map.addOverlay(markers);
          markers.setLabel(label);
    }


//获取覆盖物位置
function attribute(e){
    var p = e.target;
    console.log("marker的位置是" + p.getPosition().lng + "," + p.getPosition().lat);
}
function addClickHandler(content,marker){
    marker.addEventListener("click",function(e){
        openInfo(content,e)}
    );
}
function openInfo(content,e){
    var p = e.target;
    var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
    var sContent ='<div>'
        +'<ul class="list">'
        +'<li style="width: 4.3rem;height: 0.78rem;line-height: 0.78rem;border-bottom: 1px solid #ccc;"><i>开合状态:' + status + '</i></li>'
        +'</ul>'
        +'</div>';
    var infoWindow = new BMap.InfoWindow(sContent); // 创建信息窗口对象
    map.openInfoWindow(infoWindow,point); //开启信息窗口
}

    // 覆盖区域图层测试
   // map.addTileLayer(new BMap.PanoramaCoverageLayer());
    var stCtrl = new BMap.PanoramaControl(); //构造全景控件
    stCtrl.setOffset(new BMap.Size(20, 20));
    map.addControl(stCtrl);//添加全景控件


